package com.hksj.sglm.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hksj.common.core.model.Rest;
import com.hksj.sglm.query.OxygenConcentrationQuery;
import com.hksj.sglm.query.SpecialGasPressureHistoryQuery;
import com.hksj.sglm.query.SpecialGasPressureQuery;
import com.hksj.sglm.service.SpecialGasPressureService;
import com.hksj.sglm.vo.OxygenConcentrationVO;
import com.hksj.sglm.vo.SpecialGasPressureHistoryVO;
import com.hksj.sglm.vo.SpecialGasPressureVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletResponse;

@Api(tags = "特气泄漏-气体压力设备列表")
@RestController
@RequestMapping("/api/sglm/specialGasPressure")
public class SpecialGasPressureController {

    @Autowired
    private SpecialGasPressureService specialGasPressureService;

    @ApiOperation(value = "查询气体压力监测设备列表", response = SpecialGasPressureVO.class)
    @PostMapping("/querySpecialGasPressureByPage")
    public Rest<IPage<SpecialGasPressureVO>> querySpecialGasPressureByPage(@RequestBody SpecialGasPressureQuery query) {
        return Rest.ok(specialGasPressureService.querySpecialGasPressureByPage(query));
    }

    @ApiOperation(value = "查询气体压力监测设备压力趋势(分页)", response = SpecialGasPressureHistoryVO.class)
    @PostMapping("/querySpecialGasPressureHistory")
    public Rest<IPage<SpecialGasPressureHistoryVO>> querySpecialGasPressureHistory(@RequestBody SpecialGasPressureHistoryQuery query) {
        return Rest.ok(specialGasPressureService.querySpecialGasPressureHistory(query));
    }

    @ApiOperation(value = "导出气体压力监测设备压力趋势", response = SpecialGasPressureHistoryVO.class)
    @PostMapping("/exportSpecialGasPressureHistory")
    public void exportSpecialGasPressureHistory(@RequestBody SpecialGasPressureHistoryQuery query, HttpServletResponse response) {
        specialGasPressureService.exportSpecialGasPressureHistory(query,response);
    }

}
